<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Manazra.Controllers.AuthorViewModel>" %>
<%@ Import Namespace="Manazra.Helpers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Articles By <%= Html.FormatUserName(Model.Author, false) %>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <% Html.RenderPartial("~/Views/Articles/UserControls/ArticlesOrder.ascx"); %>
    <h2>Articles Posted By <%= Html.FormatUserName(Model.Author, false) %></h2>
    
    <% foreach (var item in Model.Articles) {%>
        <div class="entry">                            
            <div class="label">
                <%= String.Format("<a href='/Articles/Details/{0}'>{1}</a>", item.RecId + "_" + Html.Encode(item.Title.Replace(' ', '_')), Html.Encode(item.Title)) %>
            </div>
            <div class="info">          
                Posted by <%= Html.FormatUserName(item.Author, false) %>
                <% Html.RenderPartial("~/Views/Articles/UserControls/ArticleTimeAgo.ascx", item); %>
            </div>
            <div class="segmentintro">
                <%= Html.Encode(item.Intro) %>... <%= String.Format("<a href='/Articles/Details/{0}'>(Read More)</a>", item.RecId + "_" + Html.Encode(item.Title.Replace(' ', '_'))) %>
            </div>
            <% Html.RenderPartial("~/Views/Articles/UserControls/ArticleStats.ascx", item); %>            
        </div>
    <% } %>
    
    <div class="pagingbar" style="text-align: center;">
        <% if (Model.Articles.HasPreviousPage) { %>
            <%= Html.ActionLink("Previous Page", ViewContext.RouteData.Values["action"].ToString(), new { page = (Model.Articles.PageIndex - 1) }, new { @class = "left" })%>
        <%} if(Model.Articles.HasNextPage){ %>
            <%= Html.ActionLink("Next Page", ViewContext.RouteData.Values["action"].ToString(), new { page = (Model.Articles.PageIndex + 1) }, new { @class = "right" })%>            
        <%} %>
        Page <%= Model.Articles.PageIndex + 1%> of <%= Model.Articles.TotalPages%>
    </div>

</asp:Content>

